<!DOCTYPE html>
<html ng-app="aa">
	<head>
		<meta charset="UTF-8">
		<title>双向数据绑定</title>
		<script type="text/javascript" src="js/angular.js" ></script>
		<script>
		/**原生的timeout可以执行改变,但是不能刷新数据。*/
			var aa=angular.module("aa",[]);
			aa.controller("aa_con",["$scope","$timeout",function($scope,$timeout){
				$scope.name="原始数据";
				$timeout(function(){
					$scope.name="两秒后的数据";
				},2000);
			}]);
			
			aa.controller("bb_con",["$scope",function($scope){
				$scope.click_name="点击前";
				$scope.show=function(){
					$scope.click_name="点击后";
				};
			}]);
			
			aa.controller("cc_con",["$scope",function($scope){
				$scope.click_name="点击前2";
				
			}]);
			
			
		</script>
	</head>
	<body>
		<div ng-controller="aa_con">
			<p>{{name}}</p>
		</div>
		
		<div ng-controller="bb_con" ng-click="show();">
			<p>{{click_name}}</p>
		</div>
		
		<div ng-controller="cc_con" ng-click="click_name='点击后2'">
			<p>{{click_name}}</p>
		</div>
	</body>
</html>
